package logic

import (
	"context"
	"zf/models/mysql"

	"zf/zfrpc/internal/svc"
	"zf/zfrpc/zfrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type GoodHomeShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGoodHomeShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodHomeShowLogic {
	return &GoodHomeShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *GoodHomeShowLogic) GoodHomeShow(in *zfrpc.GoodHomeShowRequest) (*zfrpc.GoodHomeShowResponse, error) {
	// todo: add your logic here and delete this line
	var goodHome mysql.GoodHome
	mysql.DB.Debug().Where("id=?", in.GoodHomeId).Find(&goodHome)

	return &zfrpc.GoodHomeShowResponse{
		Name:    goodHome.Name,
		Status:  goodHome.Status,
		Image:   goodHome.Image,
		Address: goodHome.Address,
		Info:    goodHome.Info,
	}, nil
}
